import request from '@/utils/request'
import {encodeParams} from '@/utils'

//列表
export function getList(data) {
  return request({
    url: '/api/channel?${encodeParams(data)}',
    method: 'POST',
    data
  })
}

export function getChannelList(data) {
  return request({
    url: '/api/channel/list',
    method: 'POST',
    data
  })
}

//创建
export function create(data) {
  return request({
    url: '/api/channel/create',
    method: 'POST',
    data
  })
}


//根据id查询
export function getById(id) {
  return request({
    url: `/api/channel/get/${id}`,
    method: 'GET',
  })
}

//更新
export function update(data) {
  return request({
    url: '/api/channel/update',
    method: 'POST',
    data
  })
}
//启用禁用
export function changeEnable(id, enable) {
  return request({
    url: `/api/channel/enable/${id}/${enable}`,
    method: 'GET',
  })
}
export default {
  getList, update, getById, create,changeEnable,getChannelList
}
